
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<HEAD>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<title>兑奖点管理</title>
	<script language="javascript" src="../script/common.js"></script>
	
	
	<!--动态js-->
	<script language="javascript">
//页面1
//【动作】
//查询（页面1）
//【静态显示】
//省/大区名称，地市名称，兑奖点名称
//【数据列表】（明细表）
//礼品目录名称，礼品名称，礼品类别，种类，数量，操作员编号，操作员姓名 ，系统时间
	
		//模拟后台显示数据
		var data = parent.datadpi;
		function bd(d){
			return [d.awardlistname,d.awardname,d.awardtype,d.awardclass,d.integral,d.pnumber,d.pname,d.time,d.id]; 
		}
		
		
		//全局变量
		var org = Common.cOrg();	//当前单位	
		var qt = {};				//数据表格对象
		var inited = false;			//初始化标志
		//页面控件初始化
		function init(){
			Common.initDict("oprovince","province","全部");
			Common.initDict("ocity","areaId","全部");
			Common.initDict("ostation","meshPoint","全部");
			inited = true;
		}
		
		function load(){
			Eui.showNavigation();
			if (!inited)
				init();		
			createTable();	
		}
		function province(v){			
			return Common.getText("province",v);
		}
		function city(v){			
			return Common.getText("areaId",v);
		}
		function station(v){			
			return Common.getText("meshPoint",v);
		}
		/**查询部分**/
		//生成查询语句
		function createQuery(){
			var date = new Date();
			var oprovince = $("search").oprovince.value;
			var ocity = $("ocity").value;
			var ostation = $("ostation").value;

			pageObj.objects = [];
			for (prop in data){
				var d = data[prop];
				if (!d||!d.id) continue;
				d.time =date.format();
				d.pname = Common.cOperator().name;
				if ((!oprovince||d.province==oprovince)
					&&(!ocity||d.city==ocity)
					&&(!ostation||d.station==ostation)
				){
					pageObj.objects.push(bd(d));
				}
			}
			var q = new Query("select o.id,o.name,o.uniqueId,o.enabled,o.nation from Person as o join o.organization as org where 1=1");
			return q;
		}
		//设置表格数据列
		function createColumn(){
			var columns = [						
				{title:"礼品目录名称",width:"18%"},
				{title:"礼品名称",width:"10%"},	
				{title:"礼品类别",width:"14%",render:awardtype},										
				{title:"种类",width:"8%",render:awardclass},	
				{title:"数量",width:"10%"},
				{title:"操作员编号",width:"12%"},
				{title:"操作员名称",width:"12%"},	
				{title:"系统时间",width:"14%"}					
			]
			return columns;
		}
		function awardclass(awardclass){
			return Common.getText("awardclass",awardclass);
		}
		function awardtype(awardtype){
			return Common.getText("userType",awardtype);
		}
		//生成表格，创建QueryTable对象
		function createTable(){
			qt = new QueryTable("datalist",createQuery,createColumn());
			showData();					//显示查询结果方法
		}
		function Cancl(){
			switchPage("listview");
			$("cardabate").reset();
		}
		//显示、刷新表格
		function showData(){	
			qt.showTable();				//qt为全局的QueryTable对象
		}
		
	</script>
</HEAD>

<body onload="load()">
	<!--页面导航-->
	<div class="nav"><div id="nav">&nbsp;</div></div>
	<div id="content">
	<!--查询静态页面部分-->
	<div id="listview">	
		<!--查询条件form-->
		<div class="searchForm">
			<form  id="search"name="search">
			<table cellSpacing=0 cellPadding=4 width="100%" border=0>
				<tr>
					<td><label>省/大区名称</label> <select id="oprovince" name="oprovince"></select></td>
					<td><label>地市名称</label> <select name="ocity" id="ocity"></select></td>
					<td><label>兑奖点名称</label> <select name="ostation" id="ostation"></select></td>			
					<td><button type="button" onclick="showData()">查 询</button></td>
				</tr>
			</table>
			</form>
		</div>

		<div class=listBorder>
			<div class="listBar">
				<div class="listTitle">单位成员列表</div>
				<div class="listBtn" id="listBtn">
					
				</div>
			</div>
			
		<!--查询结构列表-->
			<div id=datalist>
			</div>
			
			<div class="listBar">
				<div class="listTitle"></div>
				<div class="listBtn">
					
				</div>
			</div>
		</div>
	</div>

	</div>
</body>
</HTML>